import {
    dateFormat
} from "../filters";

export function parseTimeFormatter(field) {
    return (row) => {
        return parseTime(null, row[field])
    }
}
export function formatTime(_, v) {
    return parseTime(_, v);
}
export function timeFormatter(_, v) {
    return parseTime(_, v);
}
export function parseTime(_, dateStr) {
    if (dateStr === '0001-01-01T00:00:00Z') {
        return '';
    }
    const d = new Date(dateStr);
    return dateFormat(d)
}

export function moneyFormatter(field) {
    return (row) => {
        return (row[field] / 100).toFixed(2)
    }
}

export function moneyFormat(_, v) {
    return (v / 100).toFixed(2)
}
